//
//  DemoPageAViewController.swift
//  DemoPageA-DemoPageA
//
//  Created by Vencent on 2021/1/19.
//

import UIKit
import SwiftCTRouter

class DemoPageAViewController: UIViewController {

    lazy var statusBarStyle: UIStatusBarStyle = {
        let i = Int.random(in: 0...1)
        return i == 0 ? .default:.lightContent
    }()
    
    override var preferredStatusBarStyle: UIStatusBarStyle {
        return self.statusBarStyle
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
        self.view.backgroundColor = .white
        
        let pushButton = UIButton.init(frame: CGRect.init(x: 0, y: 100, width: 100, height: 100))
        pushButton.setTitle("Push", for: .normal)
        pushButton.setTitleColor(.blue, for: .normal)
        pushButton.addTarget(self, action: #selector(pushAction), for: .touchUpInside)
        self.view.addSubview(pushButton)
        pushButton.center = self.view.center
        
        let popButton = UIButton.init(frame: CGRect.init(x: 0, y: 100, width: 100, height: 100))
        popButton.setTitle("Pop", for: .normal)
        popButton.setTitleColor(.blue, for: .normal)
        popButton.addTarget(self, action: #selector(popAction), for: .touchUpInside)
        self.view.addSubview(popButton)
    }
    
    @objc func pushAction() {
        if let demoPageAVC = SwiftCTRouter.DemoPageA_Demo_ViewController() {
            self.navigationController?.pushViewController(demoPageAVC, animated: true)
        }
    }
    
    @objc func popAction() {
        self.navigationController?.popViewController(animated: true)
    }

}
